<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <div id="box"></div>
    <button onclick="clearTimeout(timer2) ">点击</button>
    <script>
      //    setInterval(函数,时间)
      //   let i = 0;
      //   let timer = setInterval(() => {
      //     console.log(123);
      //     if (i == 8) {
      //       clearInterval(timer);
      //     }
      //     i++;
      //   }, 1000);

      //   let timer2 = setTimeout(() => {
      //     console.log(456);
      //   }, 3000);
    </script>
  </body>
</html>
